package tests;

import java.util.ArrayList;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import fi.helsinki.cs.kaisei.*;
import fi.helsinki.cs.kaisei.Weekday.Day;

import junit.framework.TestCase;


public class ReportTest extends TestCase {
	
	private ArrayList<Timetable> timetables;
	private Report report;
	
    @Before
    public void setUp() throws Exception {
    	timetables = new ArrayList<Timetable>();
    	Timetable timetable;
    	
    	timetable = new Timetable(51,2);
    	timetable.addEvent(Day.MON, new Event("08","20","someevent","somelocation"));
    	timetables.add(timetable);
    	
    	timetable = new Timetable(49,4);
    	timetable.addEvent(Day.SUN, new Event("12","16","someotherevent","someotherloc"));
    	timetables.add(timetable);
    }
    
    @After
    public void tearDown() throws Exception {
    	timetables = null;
    	report = null;
    }
    
    @Test
    public void testConstructor() {
    	report = new Report(timetables);
    	
    	assertNotNull(report);
    	assertEquals(timetables, report.getTimetables());
    	
    	report = null;
    	
    	assertNull(report);
    }
    
    @Test
    public void testToString() {
    	report = new Report(timetables);
    	
    	String output = report.toString();
    	
    	assertTrue(output.contains("08:00 - 20:00"));
    	assertTrue(output.contains("someevent"));
    	assertTrue(output.contains("somelocation"));
    	
    	assertTrue(output.contains("12:00 - 16:00"));
    	assertTrue(output.contains("someotherevent"));
    	assertTrue(output.contains("someotherloc"));
    }
    
}
